package actions;

import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.StudentModel;

import org.apache.struts.action.*;

import db.DbException;
import forms.ChairsForm;

public class ChairsDeleteReviewerAction extends Action
{
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		ChairsForm iForm = (ChairsForm) form;

		String reviewer = request.getParameter("reviewer");
		
		// Delete the reviewer from the users tables
		StudentModel.deleteReviewer(reviewer);
		
		Vector reviewers = StudentModel.getAllReviewers();
		request.getSession().setAttribute("reviewers", reviewers);
		
		int numReviewers = StudentModel.numReviewers();
		iForm.setNumReviewers(numReviewers);

		return mapping.findForward("success");
	}
}
